package me.qi.kancha.security.configuration;

import me.qi.kancha.security.JwtTokenConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;

/**
 * 认知配置需要的Bean
 *
 * @author sun
 * @date 2021/12/16 16:04
 * @modified By：
 */
@Configuration
public class AuthBeanConfiguration {

    @Bean
    public TokenStore tokenStore(JwtTokenConverter jwtTokenConverter) {
        return new JwtTokenStore(jwtTokenConverter);
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
